home *** CD-ROM | disk | FTP | other *** search
/ DarkBASIC - The Ultimate 3D Game Creator / PCactive 8 CD1 - DarkBasic.iso / SOFTWARE / DEMOS / DarkForge2000 / darkdistort / darkdistort.dba next >
Encoding:
Text File  |  2000-03-25  |  1.6 KB  |  94 lines

  1. ` -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  2. `              DarkDistort
  3. ` -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  4. ` By Rich Davey (rich@fatal-design.com)
  5. ` -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  6. ` Re-creates  the classic  dist effects
  7. ` from  the  ST/Amiga days. Use cursors 
  8. ` to  control speed. Change the Z value
  9. ` below for different effects.
  10. `
  11. ` Music listened  to while  coding this
  12. ` The Sound of Homelands (Ministry).
  13. ` -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  14.  
  15. sync rate 40
  16. sync on
  17. hide mouse
  18.  
  19. ink rgb(255,255,255),rgb(0,0,0)
  20. center text 320,0,"- DarkForge -"
  21. center text 320,16,"Use arrow keys to change distortion"
  22.  
  23. `    You can replace this bitmap with any 320x240 image
  24.  
  25. load bitmap "zod4.bmp",1
  26. set current bitmap 1
  27.  
  28. `    Change the Z value for a smoother distortion effect
  29. `    it must be a multiple of 2 (i.e. 2, 4, 6, 8, 16)
  30.  
  31. z=2; y=0
  32.  
  33. `    Let's grab our bobs!
  34.  
  35. for i=1 to 240/z-1
  36.  
  37.     get image i,0,y,320,y+z
  38.     bob i,-100,-100,i
  39.     y=y+z
  40.  
  41. next i
  42.  
  43. delete bitmap 1
  44.  
  45. `    Build a basic sine-wave array
  46.  
  47. dim sine#(360)
  48.  
  49. for s=0 to 360
  50.     sx#=sin(s)*100
  51.     sine#(s)=sx#
  52. next s
  53.  
  54. `    Set-up the initial values
  55.  
  56. count=240/z; step=1; speed=4; sx=0
  57.  
  58. set current bitmap 0
  59.  
  60. do
  61.  
  62.     sync
  63.  
  64.     for a=1 to count
  65.         bob a,150+sine#(wrapvalue(sx+a*step)),120+(a*z),a
  66.     next a
  67.  
  68.     sx=sx+speed
  69.  
  70.     if upkey()
  71.         inc speed
  72.         if speed>64 then speed=64
  73.     endif
  74.  
  75.     if downkey()
  76.         dec speed
  77.         if speed<0 then speed=0
  78.     endif
  79.  
  80.     if leftkey()
  81.         inc step
  82.         if step>16 then step=16
  83.     endif
  84.  
  85.     if rightkey()
  86.         dec step
  87.         if step<0 then step=0
  88.     endif
  89.  
  90.     if spacekey() then end
  91.  
  92. loop
  93.  
  94.